package com.tq.teaching_quality.controller;


import com.tq.teaching_quality.entity.SurveyDetail;
import com.tq.teaching_quality.service.SurveyDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 问卷明细，即一份问卷的问题清单 前端控制器
 * </p>
 *
 * @author YTH
 * @since 2020-06-29
 */
@RestController
@RequestMapping("/survey-detail")
public class SurveyDetailController {

    @Autowired
    private SurveyDetailService SurveyDetailService;

    //增加一条记录
    @RequestMapping("/AddSurveyDetail")
    public boolean AddSurveyDetail(@PathVariable("SurveyDetail") SurveyDetail SurveyDetail){
        return SurveyDetailService.save(SurveyDetail);
    }

    //删除一条记录
    @RequestMapping("/DeleteSurveyDetail")
    public boolean DeleteSurveyDetail(@PathVariable("SurveyDetailId") Long SurveyDetailId){
        return SurveyDetailService.removeById(SurveyDetailId);
    }

    //查询全部记录
    @RequestMapping("/SelectAllSurveyDetail")
    public List<SurveyDetail> SelectAllSurveyDetail(){
        return SurveyDetailService.list();
    }

    //修改一条记录
    @RequestMapping("/UpdateSurveyDetail")
    public boolean UpdateSurveyDetail(@PathVariable("SurveyDetail") SurveyDetail SurveyDetail){
        return SurveyDetailService.updateById(SurveyDetail);
    }

}

